<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>手机商城</title>
<!-- CSS -->
<link rel="stylesheet" href="{url:#css/materialize.min.css}" />
<link rel="stylesheet" href="{url:#css/me.css}" />
<link rel="stylesheet" href="{url:#css/iconfont.css}" />

<style type="text/css">
.btn {
  display: inline-block;
  margin-bottom: 0;
  font-weight: normal;
  text-align: center;
  vertical-align: middle;
  touch-action: manipulation;
  cursor: pointer;
  background-image: none;
  border: 1px solid transparent;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.42857;
  border-radius: 3px; 
  }
  .btn:hover{
  	background-color:#c71f1f;
  }
  .btn-main 
  {
	  color: #FFF;
	  background-color: #dd2727;
	  border-color: #c71f1f; 
  }




/**去除绿色下划线 - 开始*/
input::-webkit-input-placeholder {
    color: #7e7e7e;
    text-indent: 5px;
}
input:not([type]),input[type=text],input[type=password],input[type=email],input[type=url],input[type=time],input[type=date],input[type=datetime-local],input[type=tel],input[type=number],input[type=search],textarea.materialize-textarea{background-color:transparent;border:none;border-radius:0;outline:none;height:1.5em;width:100%;font-size:1rem;margin:0;padding:0;box-shadow:none;}
input:not([type]):focus:not([readonly]),input[type=text]:focus:not([readonly]),input[type=password]:focus:not([readonly]),input[type=email]:focus:not([readonly]),input[type=url]:focus:not([readonly]),input[type=time]:focus:not([readonly]),input[type=date]:focus:not([readonly]),input[type=datetime-local]:focus:not([readonly]),input[type=tel]:focus:not([readonly]),input[type=number]:focus:not([readonly]),input[type=search]:focus:not([readonly]),textarea.materialize-textarea:focus:not([readonly]){border-bottom:none;box-shadow:none}
/**去除绿色下划线 - 结束*/

/*开始*/
.q-rsub
{
	text-align:right;
	padding:5px 0px;
}
q-rteu
{
	padding:5px;}
.q-rsum
{
	width:50px;
	height:30px;
	background-color:#C00;
	margin-right:10px;
	border:none;
	color:#FFF;
	font-family:"微软雅黑";
}

.q-rtine
{
	width:330px;
	height:50px;
	margin:5px 0px;
	background-color:#f9e4be;
}

.q-rtane
{
	width:330px;
	height:50px;
	margin:5px 0px;
	background-color:#b5e5f1;
}
.q-rtine-left
{
	width:320px;
	height:30px;
	line-height:30px;
	margin:0 auto;
}
.q-rtine-right
{
	width:320px;
	height:20px;
	line-height:20px;
	text-align:right;
	margin:0 auto;
}
.q-rkain
{
	font-weight:bold;
}
.q-mous
{
	width:100%;
	height:1px;
	background-color:#F34E0E;
}
.q-v-mous
{
	width:80px;
	height:20px;
	text-align:right;
	display:inline-block;
}
/*结束*/
</style>
<!-- JS -->
<script src="{url:#js/jquery-1.11.3.min.js}"></script>
<script src="{url:#js/materialize.min.js}"></script>
<script src="{url:#js/home/register.js}"></script>
<script src="{url:#js/yang_check.js}"></script>
</head>
<body class="q-body">
<!-- TitleBar 开始 -->
<div class="navbar-fixed">
  <nav>
    <div class="nav-wrapper red accent-4 valign-wrapper">
      <ul class="left" id="nav-btn-left">
        <li><a><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
      <span class="title-bar-size center_align">订单支付</span>
      <ul class="right">
        <li><a  class="disabled" style="visibility:hidden"><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
    </div>
  </nav>
</div>
<!-- TitleBar 结束 -->

<div class="container">
	 <div class="q-reg-box">
	 
	    <table class="bordered">
      	<tbody>
          <tr>
              <th data-field="id" class="q-v-mous">订单编号</th>
              <td>{$order_obj['order_no']}</td>
          </tr>
          <tr><div class="q-liner"></div></tr>
          <tr>
             <th data-field="name" class="q-v-mous">订单金额</th>
             <!-- 
             <td>{$order_obj['order_amount']} [ 现金币: <span style="color:red;">{$order_obj['xjb']}</span> 购物币: <span style="color:red;">{$order_obj['gwb']}</span> ]</td>
             -->
             <td>{$order_obj['order_amount']}</td>
          </tr>
          
          
         <!-- 
         <tr valign="middle">
                <th data-field="price" class="q-v-mous" style="margin-top:10px;" valign="middle">支付方式</th>
                <td valign="valign-wrapper">
                    <img src="{url:#images/logo_weixin.png}" style="width:35px;height:35px; float: left" />
                    <div style="margin-left:20px;font-size:1.3em;height: 35px;float: left;vertical-align: middle;line-height: 35px;">微信支付</div>
                    <div style="float:right;height: 35px;line-height: 35px;vertical-align: middle;">
                        <input name="payment_id" type="radio" id="test1" value="5"/>
                        <label for="test1" style="margin-top: 5px;"></label>
                    </div>
                </td>
         </tr>
         
         <tr valign="middle">
                <th data-field="price" class="q-v-mous" style="margin-top:10px;" valign="middle">&nbsp;</th>
                <td valign="valign-wrapper">
                    <img src="{url:#images/logo_zhifubao.png}" style="width:35px;height:35px; float: left" />
                    <div style="margin-left:20px;font-size:1.3em;height: 35px;float: left;vertical-align: middle;line-height: 35px;">支付宝支付</div>
                    <div style="float:right;height: 35px;line-height: 35px;vertical-align: middle;">
                        <input name="payment_id" type="radio" id="test2" value="4"/>
                        <label for="test2" style="margin-top: 5px;"></label>
                    </div>
                </td>
         </tr>
         -->
         {if:$order_obj['payment']==10}
         <tr valign="middle">
                <th data-field="price" class="q-v-mous" style="margin-top:10px;" valign="middle">&nbsp;</th>
                <td valign="valign-wrapper">
                    <img src="{url:#images/logo_balance.png}" style="width:35px;height:35px; float: left" />
                    <div style="margin-left:20px;font-size:1.3em;height: 35px;float: left;vertical-align: middle;line-height: 35px;">积分支付</div>
                    <div style="float:right;height: 35px;line-height: 35px;vertical-align: middle;">
                        <input name="payment_id" type="radio" checked id="test3" value="10"/>
                        <label for="test3" style="margin-top: 5px;"></label>
                    </div>
                </td>
         </tr>
         {elseif:$order_obj['payment']==11}
         <tr valign="middle">
                <th data-field="price" class="q-v-mous" style="margin-top:10px;" valign="middle">&nbsp;</th>
                <td valign="valign-wrapper">
                    <img src="{url:#images/logo_balance.png}" style="width:35px;height:35px; float: left" />
                    <div style="margin-left:20px;font-size:1.3em;height: 35px;float: left;vertical-align: middle;line-height: 35px;">消费券支付</div>
                    <div style="float:right;height: 35px;line-height: 35px;vertical-align: middle;">
                        <input name="payment_id" type="radio" id="test4" checked value="11"/>
                        <label for="test4" style="margin-top: 5px;"></label>
                    </div>
                </td>
         </tr>
         {/if}
          <tr id="tr_pass2">
              <th data-field="pass2" class="q-v-mous">二级密码</th>
              <td>
              	<input type="password" name="pass2" id="pass2" style="display:block;border-bottom:0.1px solid"/>
              </td>
          </tr>
          <tr>
          	<td colspan='2' style="text-align:center;">
          		<input type="hidden" id="order_id" name="order_id" value="{$order_obj['id']}"/>
          		<input type="hidden" id="order_amount" name="order_amount" value="{$order_obj['order_amount']}"/>
          		<span id="sp_pay_1">
          		<input type="button" class="btn btn-main" value="立即支付" onclick="sub_pay_do(this)"/>
          		</span>
          		
          		<span id="sp_pay_2" style="display:none;">
          			<form name="alipayment" action="./new_zfb_pay/alipayapi.php" method="post" target="_blank">
          			    <!-- 订单号 -->
          				<input type="hidden" name="WIDout_trade_no" id="WIDout_trade_no" value="{$order_no}"/>
          				
          				<!-- 订单名称 -->
          				<input type="hidden" name="WIDsubject" id="WIDsubject" value="{$goods_name}"/>
          				
          				<!-- 订单金额 -->
          				<input type="hidden" name="WIDtotal_fee" id="WIDtotal_fee" value="{$order_amount}"/>
          				
          				<!-- 商品展示链接 -->
          				<input type="hidden" name="WIDshow_url" id="WIDshow_url" value="http://www.mwantu.com/index.php?con=mobile&act=product_detail&id=1103"/>
          				
          				<!-- 商品描述 -->
          				<input type="hidden" name="WIDbody" id="WIDbody" value="{$goods_name}"/>
          				
          				<input type="submit" class="btn btn-main" style="background:green;" value="立即支付" onclick="return confirm('确定要执行此操作吗？')"/>
          			</form>
          		</span>
          		
          	</td>
          </tr>
          	<!-- 
           <tr style="border-bottom:0px">
              <td colspan='2' style="color:#f0ad4e;">*提示：如果选择预存款支付，将同时按比例扣除余额现金币和购物币；如果选择在线支付则是全额支付不扣购物币。</td>
          </tr>
          -->
          
          </tbody>
        </table>
        
        <!-- 
        <div class="q-mous"></div>
      	-->
     	
   </div>
 </div>
<script type="text/javascript">

$(document).ready(function(){
	$("input[name='payment_id']").each(function(){
		$(this).click(function(){
			var v = parseInt($(this).val());
			if( v == 4 )//支付宝支付
			{
				//$("#pass2").attr("disabled", true);
				//二级密码隐藏
				$("#tr_pass2").hide();
				$("#sp_pay_1").hide();
				$("#sp_pay_2").show();
			}
			else if( v == 5 )//微信支付
			{
				$("#tr_pass2").hide();
				$("#sp_pay_1").show();
				$("#sp_pay_2").hide();
			}
			else if( v == 1)
			{
				//$("#pass2").attr("disabled", false;);
				//二级密码显示
				$("#tr_pass2").show();
				$("#sp_pay_1").show();
				$("#sp_pay_2").hide();
			}
		});
	});
});


function sub_pay_do(obj)
{
	var payment_id =  $("input[name='payment_id']:checked").val() ;
	
	var pass2 = $("#pass2").val();
	if(payment_id == null)
	{
		yang_alert("请选择支付方式");
		return;
	}
	
	if( pass2 == '' || pass2 == null )
	{
		yang_alert('二级密码不能为空');
		return;
	}
	
	var order_id   = $("#order_id").val();
	
	$(obj).attr('disabled',true);
	
    $.post('{url:/mobile/pay_do}',{order_id:order_id,pass2:pass2,payment_id:payment_id},function(data){
        if( data['status']=='success' )
	    {
        	//alert('支付成功');
        	
		    yang_alert('支付成功');
		    
		    //替换历史记录
		    window.location.replace("{url:/mobile/user_center}");
		    
		    //支付成功，跳转到待发货页面
		    document.location.href="{url:/mobile/order_list/type/2}";
        }
        else if(data['status']=='wx_sign')
        {
        	if(data['msg']=='error')
        	{
        		alert('支付失败');
        		//$(obj).attr('disabled',false);
        	}
        	else
        	{
        		//alert(data['msg']);
        		//支付成功跳转到页面
        		//2代表微信支付
        		NativeBinder.payOrder("{'type':2,'signData':'"+data['msg']+"','successUrl':'{url:/mobile/order_list/type/2}'}");
        		//NativeBinder.payOrder(2, data['msg']+"","{url:/mobile/order_list/type/2}");
        	}
        }
        else
	    {
        	yang_alert(data['msg']);
            //yang_alert(data['msg']);
            $(obj).attr('disabled',false);
        }
        
      },'json');
}
</script>
</body>
</html>
